// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import "babel-polyfill";
import Utils from '@/utils/index';
import App from './App';
import store from './store';
import router from './router';
import filters from './utils/filters';
import util from './utils/util';
import http from './utils/fetch';
import Vant from 'vant';
import 'vant/lib/index.css';

import './utils/px2rem';
// 自定义组件
let components = {
  InviteBtn: resolve => require.ensure([], () => resolve(require('@/base/invitebtn'))),
  GlPicker: resolve => require.ensure([], () => resolve(require('@/base/glpicker'))),
  VipTip: resolve => require.ensure([], () => resolve(require('@/base/viptip'))),
  DiscountCard: resolve => require.ensure([], () => resolve(require('@/base/discountcard'))),
  GlPlayVideo: resolve => require.ensure([], () => resolve(require('@/base/playvideo'))),
  GlItem: resolve => require.ensure([], () => resolve(require('@/base/glitem'))),
  GlSelect: resolve => require.ensure([], () => resolve(require('@/base/glselect'))),
  CountDown: resolve => require.ensure([], () => resolve(require('@/base/countdown'))),
};

Object.keys(components).map(k => {
  Vue.component(k, components[k]);
});

require("./less/component-style.less");

// 实例化Vue的filter
Object.keys(filters).forEach(k => Vue.filter(k, filters[k]));

Vue.use(Utils);
Vue.use(Vant);


Vue.prototype.$utils = Utils;
Vue.config.productionTip = false;
Vue.prototype.util = util;
Vue.prototype.http = http;

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  components: {App},
  template: '<App/>'
})
